<?php
namespace app\common\model;

use think\Model;

class User extends Model
{
    protected $insert = ['create_time'];

    /**
     * 创建时间
     * @return bool|string
     */
    protected function setCreateTimeAttr()
    {
        return date('Y-m-d H:i:s');
    }

    /**
     * 关联用户头像
     */
    public function file()
    {
        return $this->belongsTo('Files','avatar', 'id')->bind([
            'avatar_path' => 'path'
        ]);
    }
}